﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Pixysoft.Framework.Configurations
{
    public interface IXmlNodeCollection :
        IEnumerator<IXmlNode>, IEnumerable<IXmlNode>
    {
        /// <summary>
        /// 添加节点
        /// </summary>
        /// <param name="text"></param>
        IXmlNode Add(string elementName);

        /// <summary>
        /// 添加节点
        /// </summary>
        /// <param name="text"></param>
        IXmlNode Add(string elementName, string text);

        /// <summary>
        /// 添加节点
        /// </summary>
        /// <param name="text"></param>
        void Add(IXmlNode node);

        /// <summary>
        /// 根据位置获取节点
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        IXmlNode this[int index] { get;}

        /// <summary>
        /// 根据名称获取节点 如果不存在 则返回一个空类型的节点
        /// </summary>
        /// <param name="elementName"></param>
        /// <returns></returns>
        IXmlNode this[string elementName] { get;}

        /// <summary>
        /// 数目
        /// </summary>
        int Count { get; }

        /// <summary>
        /// 是否包含节点
        /// </summary>
        /// <param name="elementName"></param>
        /// <returns></returns>
        bool Contains(string elementName);

        /// <summary>
        /// 移除
        /// </summary>
        /// <param name="elementName"></param>
        /// <returns></returns>
        IXmlNode Remove(string elementName);

        /// <summary>
        /// 清空
        /// </summary>
        void Clear();
    }
}
